<template>
  <div class="heritageRoad">
    <!-- header -->
    <Head />
    <Banner />
    <Nav />
    <!-- /header -->

    <div class="main">
      <div class="middle">
        <!-- 导航栏 -->
        <SideBar></SideBar>
        <!-- 导航栏 -->
        <!-- 工作室概况 -->
        <div class="block">
          <!-- 标题 -->
          <div class="title">
            <h3 @click="$router.push({ path: '/videoMaterial' })">视频资料</h3>
          </div>
          <!-- 内容 -->
          <div class="content">
            <h3>{{ spzlDetail.title }}</h3>
            <p>
              <span>{{ spzlDetail.addtime | dateFormat }}</span>
              <span>作者：</span>
              <span>{{ spzlDetail.adduser }}</span>
              <span>浏览：</span>
              <span>{{ spzlDetail.djs }}</span>
            </p>
            <div class="detail">
              <p v-html="spzlDetail.spjs">{{ spzlDetail.spjs }}</p>
              <div v-show="spzlDetail.spurl">
                <video
                  ref="audio"
                  width="100%"
                  height="400px"
                  controls="controls"
                >
                  你的浏览器不支持video
                </video>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- footer -->
    <Footer></Footer>
    <!-- /footer -->
  </div>
</template>

<script>
import Head from "@/components/Head.vue";
import Banner from "@/components/Banner.vue";
import Nav from "@/components/Nav.vue";
import Footer from "@/components/Footer.vue";
import SideBar from "@/components/SideBar.vue";
export default {
  name: "HeritageRoad",
  components: {
    Head,
    Banner,
    Nav,
    Footer,
    SideBar,
  },
  data() {
    return {
      spzlDetail: {}, //传承之路详情页
      id: "", //路由id
    };
  },
  created() {
    // 获取路由id
    this.getId();
    this.getMenulist();
  },
  methods: {
    //首页接口
    getMenulist() {
      var query = {
        id: this.id,
        page: 1,
        limit: 10,
      };
      this.$axios
        .get("TCM/spzl", { params: query })
        .then((res) => {
          if (res.status == 200) {
            // console.log(res);
            this.spzlDetail = res.data.data[0];
            // console.log(this.spzlDetail);
            this.$refs.audio.src = res.data.data[0].spurl;
            console.log(res.data.data[0].spurl);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    // 获取路由的id
    getId() {
      this.id = this.$route.params.id;
    },
  },
};
</script>

<style lang="less" scoped>
@media screen and (max-width: 1200px) {
  .heritageRoad .main {
    margin: 0 !important;
  }
}
.heritageRoad {
  background: url("../assets/image/diwen.jpg") repeat-y;
  // 通知道公告
  .main {
    margin: 0 auto;
    margin: 0 25% 0;
    height: 100%;
    background-color: #ffffff;
    overflow: hidden;
    .middle {
      height: 100%;
      padding: 0 10px 10px;
      background-color: #ffffff;
      box-sizing: border-box;
      margin-top: 20px;
      display: flex;
      justify-content: space-between;
      .block {
        flex: 1;
        margin-left: 20px;
        background-color: #ffffff;
        border: 0.5px solid #ebe4d9;
        border-top: none;
        .content {
          text-align: center;
          padding: 20px 20px 10px;
          h3 {
            font-size: 24px;
            text-align: center;
            color: #2c3e50;
            margin-bottom: 20px;
          }
          span {
            font-size: 16px;
            margin-right: 10px;
          }
          .detail {
            // text-align: left;
            padding-top: 20px;
            // float: left;
            font-size: 14px;
            // font-weight: 500;
            // letter-spacing: 1px;
            // line-height: 30px;
            // margin-top: 0;
            margin-bottom: 60px;
          }
          p {
            margin-top: 0;
            text-indent: 2em;
            // font-size: 16px;
          }
        }
      }
    }
  }
}
</style>
